﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KalevaAalto.CollectionPart
{
    public class LazyAsync<T>
    {
        private Lazy<Task<T>> _lazy;

        public LazyAsync(Func<T> func)
        {
            _lazy = new Lazy<Task<T>>(async ()=>func());
        }

        public LazyAsync(Func<Task<T>> func)
        {
            _lazy = new Lazy<Task<T>>(func);
        }


        public async Task<T> GeteValueAsync()
        {
            return await _lazy.Value;
        }


    }
}
